UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KdGwhM/OQh13JtbSwAJBXjrtq5F7ep17bDUj2+kbdZ4=' 
WHERE 
  key_id = '7a1c455e7809b761eacd2374bfaa738682c63152b304e3d74f3abf9379b46536' 
  AND (
    token = 'KdGwhM/OQh13JtbSwAJBXjrtq5F7ep17bDUj2+kbdZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024