UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DEfLJ/AakgWIeE4b9a5tssTeFJdArKfNshL91ykn14s=' 
WHERE 
  key_id = '21aeb241385670707e1899b769430a9cf0281e8d550a63355bc767002ce915e5' 
  AND (
    token = 'DEfLJ/AakgWIeE4b9a5tssTeFJdArKfNshL91ykn14s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030