UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ihDfz2bXeX2D4L+IeQ+97eDVQC0qY+sjGHA7C4KwTHg=' 
WHERE 
  key_id = 'c6be61d13016faea793581bd65610fb17157afab0e11bc865d091a7756ad6f1c' 
  AND (
    token = 'ihDfz2bXeX2D4L+IeQ+97eDVQC0qY+sjGHA7C4KwTHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041